#!/bin/sh
set -e

if [ "$1" = "configure" ]; then
    if ! getent passwd ice > /dev/null; then
	adduser --quiet --system --group --no-create-home --home /var/lib/ice --gecos "Ice Service account" ice
    fi

    # Make /var/lib/ice writeable by ice:adm user
    if ! dpkg-statoverride --list /var/lib/ice >/dev/null; then
	dpkg-statoverride --update --add ice adm 0770 /var/lib/ice >/dev/null 2>/dev/null || true
    fi
fi

#DEBHELPER#

exit 0
